{% extends 'base.html' %}
{% from 'bootstrap/pagination.html' import render_pagination %}
{% block body %}
    {% if data %}
        <main class="container">
            <h1>
                <strong class="text-center">我的博客</strong>
            </h1>
        {% for post,comment in data %}
            <div class="list-group">
                <header><a href="{{ url_for('admin.operate',post_id=post.id) }}">{{ post.title[0:20] }}</a></header>
                <div class="d-flex w-100 justify-content-between">
                    <small>{{ moment(post.timestamp).fromNow(refresh=True) }}</small>
                    <small>评论数{{ comment|length }}</small>
                </div>
                <p>{{ post.body[0:500] }}</p>
            </div>
        {% endfor %}
        <div class="page-footer">
        {{ render_pagination(pagination) }}
        </div>
        </main>

    {% endif %}
{% endblock %}